import React from 'react'
import cookie from 'react-cookies'
const AuthRouter = (props) => {
	//说明判断是否要登录
	if (props.auth) {
		// 获取cookies的LoginUser
		var LoginUser = cookie.load('LoginUser') ? cookie.load('LoginUser') : {}

		if (JSON.stringify(LoginUser) === '{}') {
			return <React.$router.Navigate to="/user/base/login" />
		} else {
			return <>{props.component}</>
		}
	} else {
		return <>{props.component}</>
	}
}
export default AuthRouter